import java.util.Scanner;

public class SwitchExample3{
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
	    // Note: Strings in switch condition are supported in Java 7 and above
		String month;
		int monthNumber;
		System.out.println("Enter a month name:");
		month = scanner.next( );
		switch (month.toLowerCase()) {
	        case "january":   monthNumber = 1;
	            		  	  break;
	        case "february":  monthNumber = 2;
	            		      break;
	        case "march":	  monthNumber = 3;
	            		      break;
	        case "april":	  monthNumber = 4;
	            		      break;
	        case "may":	      monthNumber = 5;
	            		      break;
	        case "june":	  monthNumber = 6;
	            		      break;
	        case "july":	  monthNumber = 7;
	            		      break;
	        case "august":	  monthNumber = 8;
	            		      break;
	        case "september": monthNumber = 9;
	            		      break;
	        case "october":	  monthNumber = 10;
	            		      break;
	        case "november":  monthNumber = 11;
	            		      break;
	        case "december":  monthNumber = 12;
	            		      break;
	        default: 	      monthNumber = 0;
	            		      break;     // optional
		  }
			
		  if(monthNumber != 0)
			 System.out.printf("The month number for %s is %d%n", 
		          month, monthNumber);
		  else
			  System.out.println("Error: Invalid month name");
	}
}	
	